package com.zhoulu.controller.borrow;

import com.zhoulu.domain.util.LayuiResult;
import com.zhoulu.service.borrow.BorrowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class BorrowController {

    @Autowired
    private BorrowService borrowService;

    /**
     * 借书
     * @param bookId 图书id
     * @param qty 数量
     * @return
     */
    @RequestMapping(value = "borrowBook")
    public Object borrowBook(Integer bookId, Integer qty){
        try {
            return borrowService.borrowBook(bookId, qty);
        } catch (Exception e) {
            e.printStackTrace();
            return LayuiResult.error("借书失败：" + e.getMessage());
        }
    }
}
